UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aP6PapcykTyReIEQxpxu8j9VO83V6bp/g8+/RhEZjw4=' 
WHERE 
  key_id = 'a27cb28a68d914bc4c26f7a1fce5c6e4df6b301641a012f48b601d65954cc197' 
  AND (
    token = 'aP6PapcykTyReIEQxpxu8j9VO83V6bp/g8+/RhEZjw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024