UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DK37FoqPqJ7t7AgirJbJln3Gh7jBBOwQcX/+17PN8/M='
WHERE
key_id = 'eaee7dc1c7d4ad44b9f5d227993864fd60a49c915d9bff36414d68572727cf1a'
AND (
token = 'DK37FoqPqJ7t7AgirJbJln3Gh7jBBOwQcX/+17PN8/M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)