UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u5JTme268S7lmDTk8zh+lZMrO7WYfGc/R8j4f7i/zGE='
WHERE
key_id = 'a4939aa44eaa25b46251c918b2d3a7d42f3b34e2efb51ea2c4ae23c0e968909a'
AND (
token = 'u5JTme268S7lmDTk8zh+lZMrO7WYfGc/R8j4f7i/zGE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)