UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PrK1ciRhRge+Xoj92GKbImymim0TUf4S4nm8QE1FUA4='
WHERE
key_id = 'fbb14a44f84de17315e5f08e016298c930e2c95c71ba6361073b70710bad56c5'
AND (
token = 'PrK1ciRhRge+Xoj92GKbImymim0TUf4S4nm8QE1FUA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)