UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5S9rZoZzDdpYLt8VFxrnM1ppFw/wq+kuBkX/hL1Q4OI=' 
WHERE 
  key_id = 'da079d0c0098ba9d7fd0da6b399da3428c2a7e1926cab196e4ad2ca87a9f8c58' 
  AND (
    token = '5S9rZoZzDdpYLt8VFxrnM1ppFw/wq+kuBkX/hL1Q4OI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034