UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gmcO8CFj/QqgT9nxJXCtRUCABXaolOw7XhBozKyOOxk=' 
WHERE 
  key_id = '27f78dd9b9a17080147e52a6bd1d03652d909b0bd654eee7df075b86b4789e39' 
  AND (
    token = 'gmcO8CFj/QqgT9nxJXCtRUCABXaolOw7XhBozKyOOxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030