UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ya9BRIrqsZ7bThH0sTVyTld3veb7trfB2mUy2TdKcLQ=' 
WHERE 
  key_id = '5579db5a2545d7331cf4b3831238830ee1ba970529ce0772eb51e41ae204f888' 
  AND (
    token = 'Ya9BRIrqsZ7bThH0sTVyTld3veb7trfB2mUy2TdKcLQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024