UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'THYGslNGRHjznHFeCPErm0IsZrEfHYIMz2L9h5LCUKU=' 
WHERE 
  key_id = '31fccf180980144d9c5277ffdf11e7bcb73e5d4caa91b2f9ff527d3b3910ceea' 
  AND (
    token = 'THYGslNGRHjznHFeCPErm0IsZrEfHYIMz2L9h5LCUKU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026