UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sTFnyABNAn4iYCogWJxwdYEyZP+rmdcHy9mJntbA5qw=' 
WHERE 
  key_id = '411be150654bd2f322fea7f8e255b44e898e612ca3e7d107e3995af2e2e0a1e5' 
  AND (
    token = 'sTFnyABNAn4iYCogWJxwdYEyZP+rmdcHy9mJntbA5qw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029