UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xCSX0ZQHwLxdFHmiSNmqmvEgBwCTEOFol6NSeRGpiJE=' 
WHERE 
  key_id = '7265908d3c729365aa074d994e15f1032b3b0b4852afb01cf35d6c559d18a867' 
  AND (
    token = 'xCSX0ZQHwLxdFHmiSNmqmvEgBwCTEOFol6NSeRGpiJE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042