UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N176hF2p9ql5eb822ABZfXfqxODLv+yFEHcpG9EBLR8='
WHERE
key_id = '0b7a8eeb9d544674b6a4dcd25b96480e52c39ac678ca88db05fdf45fa9601f33'
AND (
token = 'N176hF2p9ql5eb822ABZfXfqxODLv+yFEHcpG9EBLR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)