UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KSRw5ljuGrEe5McKuatLyTCu5ngxzFqu3ZT5vfuFHyU=' 
WHERE 
  key_id = '9ae0b31c459c28f22522d4194d05f0db43fd1eda5d1a6332a7cd6e1855c2e4cc' 
  AND (
    token = 'KSRw5ljuGrEe5McKuatLyTCu5ngxzFqu3ZT5vfuFHyU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026