UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jW9Y+sOl5XVfNe+rmXtsOMw5W3lwNsy6D+8vn6aoxHU=' 
WHERE 
  key_id = 'fe129112437892fcb616d8c03ecc693782b3517d743a761437be35ba68adfafa' 
  AND (
    token = 'jW9Y+sOl5XVfNe+rmXtsOMw5W3lwNsy6D+8vn6aoxHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029