UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jVwKBE9wDPiFBt0p+k9iOkKA3Eu2IXkpDm6xEh67SLg='
WHERE
key_id = 'cd8efe1f2e4885e5b9d16e1737a95945f4228d2c1114f446f30ec7ce3b65b4b1'
AND (
token = 'jVwKBE9wDPiFBt0p+k9iOkKA3Eu2IXkpDm6xEh67SLg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)