UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lzwcxgzSdtLnpx/5+50+v2fwMNvcozEaxnxT0+DV8Qg=' 
WHERE 
  key_id = '17135c5ca46dd4525dc6d33f13fc33d0a0a1eec2febc368554cc316ef98e31dd' 
  AND (
    token = 'lzwcxgzSdtLnpx/5+50+v2fwMNvcozEaxnxT0+DV8Qg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026