UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V00qF38aeOYcGzAlMR1pKlx/a2BMQVwteWjmPBSLZHc=' 
WHERE 
  key_id = 'b17794f132d57e49037e3491dfb78ef15de90fb2c6cfa3c8440941a94933135d' 
  AND (
    token = 'V00qF38aeOYcGzAlMR1pKlx/a2BMQVwteWjmPBSLZHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029