UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'whp5SlFvJn2uAjBNTquOUqdTnipyIC+jzHW2DX/I7NE=' 
WHERE 
  key_id = '085837f15f2d043d7eb602a87e3a52bb01e4763954780d99e9c252b43a897c0a' 
  AND (
    token = 'whp5SlFvJn2uAjBNTquOUqdTnipyIC+jzHW2DX/I7NE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035