UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wtuh8n8y7lTYMnsQIPwC+KfkS1tR8N55t8K4htkFZQA=' 
WHERE 
  key_id = '243b4ac48b9075122c847f442d2af415a9689b01869506926be1e3adf84e606f' 
  AND (
    token = 'Wtuh8n8y7lTYMnsQIPwC+KfkS1tR8N55t8K4htkFZQA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029