UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sPpGUW82hpEuky2LFtAFny5LGRBqB/r1Zv63rftpAHE=' 
WHERE 
  key_id = 'b122710de64cdba3b22c8a6e2fd08b3e57ec576be05c9e3d2d6ab98066520889' 
  AND (
    token = 'sPpGUW82hpEuky2LFtAFny5LGRBqB/r1Zv63rftpAHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022