UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M3dbZC+j6NtPMm2tlpozfYtT+vxlti6x0aa91NrZp1s=' 
WHERE 
  key_id = '2d7e4f2432d034b05e520ce90bcd331df0ef6c12f48e2bf530c6797db237d6b8' 
  AND (
    token = 'M3dbZC+j6NtPMm2tlpozfYtT+vxlti6x0aa91NrZp1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034