UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2Pd+AioYWzecQPcwtli8V1K72SscsR+udMqLl+B+abg=' 
WHERE 
  key_id = '221fcaa7f68f3006b227cb475de99f12557d0fb6cda35b58823477b12a75f34b' 
  AND (
    token = '2Pd+AioYWzecQPcwtli8V1K72SscsR+udMqLl+B+abg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025