UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Elhfwmz18ysVmCjSw8NlLLA0SqndFGR1OCSx1DTU6LU=' 
WHERE 
  key_id = '3d6f534059fe133b87799ee99aaa3fdebff23b3c10fa846e4efbad462d4bec87' 
  AND (
    token = 'Elhfwmz18ysVmCjSw8NlLLA0SqndFGR1OCSx1DTU6LU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030