UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FSKNXX/Fa1/l/43jdIfnnXYe6taS5e1pKdhEGlE1Sf8=' 
WHERE 
  key_id = 'e0d520d948d414f9d7a80c12245152c1280226e5ab82e71c841b357ae0cd2ff5' 
  AND (
    token = 'FSKNXX/Fa1/l/43jdIfnnXYe6taS5e1pKdhEGlE1Sf8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042