UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y3sCk1SCjE4HOrmUeWU+hx2XsLtnoIVJig+AafomHKA=' 
WHERE 
  key_id = '9c4c7957d95ef6776ef8c10321ff7bb948cdee8a8cc15fc9add88b1608e86727' 
  AND (
    token = 'Y3sCk1SCjE4HOrmUeWU+hx2XsLtnoIVJig+AafomHKA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050