UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0AtTM0NjXVEf0MZb5hh2YtvaZkHVmX9wbuZu8mbFjU=' 
WHERE 
  key_id = 'e4aae1c41dd56fd8aa32a478680c6772f0fd68c37e5a6daca930d218335d85a5' 
  AND (
    token = 'O0AtTM0NjXVEf0MZb5hh2YtvaZkHVmX9wbuZu8mbFjU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040