UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a3JFpTKgxlyQkopl0+2IRlPkO33tgUKqqDcZ+f59gKU=' 
WHERE 
  key_id = '3e3762ce32e14eafbedea94d65751ed974aa745c716a38cc8731238a37fb1a5d' 
  AND (
    token = 'a3JFpTKgxlyQkopl0+2IRlPkO33tgUKqqDcZ+f59gKU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030