UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EGRUAotJEOoC7tlBtwUgh9jdsI7XSuYIQ6PuHOnrSaQ=' 
WHERE 
  key_id = '5c9030ca21b8a390a64e3b99a94f5f75f25dd4150d55e974f02b542d78645131' 
  AND (
    token = 'EGRUAotJEOoC7tlBtwUgh9jdsI7XSuYIQ6PuHOnrSaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032