UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h32olNT5y+KEcZfuDoVme8u10ojJWBQM1kCQbnX6o5I='
WHERE
key_id = 'c318289224f51dd01e5ac9ad9b385d5874d4ef68cb338e678074b4f2ba40d015'
AND (
token = 'h32olNT5y+KEcZfuDoVme8u10ojJWBQM1kCQbnX6o5I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)