UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's5k4yjiN2FXX46qkj6dyZtAYFypq6suAmHPgm1G4euA='
WHERE
key_id = 'a7efacdbcb44bbbfeaf9a2ab9f38c07fef31a27cd635c93c3f119fd1de1c8822'
AND (
token = 's5k4yjiN2FXX46qkj6dyZtAYFypq6suAmHPgm1G4euA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)