UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm2CYMUrUlNvbqOz8nLUQ0cnTpG2JibL/wNUVOGGLovM=' 
WHERE 
  key_id = 'ea072c34f626b68c687f93e74d23fc4ca4f483366efcd924989ecd1af499a643' 
  AND (
    token = 'm2CYMUrUlNvbqOz8nLUQ0cnTpG2JibL/wNUVOGGLovM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048