UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XRdxn2D/+3T/gRcHMSJs3shfwy3UHdmLeLbP0GQ0ivE=' 
WHERE 
  key_id = '09299e5e459b98aa4dfa2e3228d8407c6110f71faaa4b6cc93b25683399b8c0f' 
  AND (
    token = 'XRdxn2D/+3T/gRcHMSJs3shfwy3UHdmLeLbP0GQ0ivE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034