UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lKDRMAY3QE2rcXfC61mrIq5r3zoRvPTYhEInV1Y5IZ4='
WHERE
key_id = '9a486db1a985c01c72e496097a49f641a0dd795255b8381a3f09aa65a0e3157b'
AND (
token = 'lKDRMAY3QE2rcXfC61mrIq5r3zoRvPTYhEInV1Y5IZ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)