UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dNLgwFCBxXKs2M5O46P9CLLmagLcUc7namhwsIaTR5M=' 
WHERE 
  key_id = '7af2382d4a701eb6381fd18e7788d40650cc0306ec30cc7fdc6f4f9b6288fec7' 
  AND (
    token = 'dNLgwFCBxXKs2M5O46P9CLLmagLcUc7namhwsIaTR5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032