UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HHDf5ctpuuMLzLuxGtU1Gh8V/Le3NgJDgACSTsq2Phw=' 
WHERE 
  key_id = '28bdc421a8f0e3ea1785df64125255caa780ee972e01eee1d6de2d795fe0b44c' 
  AND (
    token = 'HHDf5ctpuuMLzLuxGtU1Gh8V/Le3NgJDgACSTsq2Phw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035