UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hK2rEUFKEt4Qywc95H2rW58LiiUExCf9A1zLagUJtsM=' 
WHERE 
  key_id = '5a9593270607bce89fa85f4812bf84270ebfee079f156a7af8b873349817f4a4' 
  AND (
    token = 'hK2rEUFKEt4Qywc95H2rW58LiiUExCf9A1zLagUJtsM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042