UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ilcq2jE8CjOdfdY5P8Cx+X9ND0w9AhLtYk7NxwSRip8=' 
WHERE 
  key_id = 'e178de5f9e871bb9d5d63876c4b9af96106927e8ae467c741ea20517c52a01be' 
  AND (
    token = 'Ilcq2jE8CjOdfdY5P8Cx+X9ND0w9AhLtYk7NxwSRip8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030