UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AH3e8W8gqwz4w8hdLjVMYxMJqYiqo8RDpL6EI46cqS8='
WHERE
key_id = '1ed12a41587c4b8b88c37204d750ff87c040f43b1a05424d07fa7923ff75601e'
AND (
token = 'AH3e8W8gqwz4w8hdLjVMYxMJqYiqo8RDpL6EI46cqS8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)