UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PfVZY7d7oiOmF1Z+uYr/LPn760RbwaFYNA3lijB24vY='
WHERE
key_id = '8fb68955bc3815e7ff9e32b0d821de7a911ff3f017c713d78003b855f01504ad'
AND (
token = 'PfVZY7d7oiOmF1Z+uYr/LPn760RbwaFYNA3lijB24vY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)