UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xFKzGjDRsRMt9XEPldMdPqf6pyauAYl+/T/pnZhhlls=' 
WHERE 
  key_id = '3d3da7e50624b457ca9ab572668eccb07c208cdc51728478d0a1eb03c63f26a7' 
  AND (
    token = 'xFKzGjDRsRMt9XEPldMdPqf6pyauAYl+/T/pnZhhlls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029