UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ul0X45kue0n5BbdiVaXgvuNksCIeXnblHRwNHq8f5e0=' 
WHERE 
  key_id = '9cdca78c3ff393382391210f13c2f46d1a5dbfd13fee8854300ebcb3fbad12f2' 
  AND (
    token = 'Ul0X45kue0n5BbdiVaXgvuNksCIeXnblHRwNHq8f5e0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021