UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7HHfygwFh8rZ+jQk2rxYw1qflqpFu3PeFlSKCnVqlP8=' 
WHERE 
  key_id = 'ad80514525a405bf72b8e0573da2885fbee9dc5acde9c77a931db61f6cc15485' 
  AND (
    token = '7HHfygwFh8rZ+jQk2rxYw1qflqpFu3PeFlSKCnVqlP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026