UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IuwCctvkzTZYqU8mPgUUnps7HDC/wCHiLwlVu0Q4AUg=' 
WHERE 
  key_id = 'e9f8f732cc09d5cac012edb8eddccc03ecda10cc1cb376b95ad6dab88c17729f' 
  AND (
    token = 'IuwCctvkzTZYqU8mPgUUnps7HDC/wCHiLwlVu0Q4AUg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034