UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Anf0/vSbwV4/T6EHGoDP2NIZTO4y1+7TUkoph+/GNkc='
WHERE
key_id = 'd501aafb5dccc95bfdfdb26eeb0dc6363f16adcefb585f33de5b0b72abc88e52'
AND (
token = 'Anf0/vSbwV4/T6EHGoDP2NIZTO4y1+7TUkoph+/GNkc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)