UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LOxedyy7Grszj3+qBBcR/Hnz71HIzxkUaiZwha+FAIM=' 
WHERE 
  key_id = '84d1d4cb1b3484262c7a062b71477f96a9ea891be615ceb8a74d73c8d987c30f' 
  AND (
    token = 'LOxedyy7Grszj3+qBBcR/Hnz71HIzxkUaiZwha+FAIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025