UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0Frp5OgE7BUj7XQOM7Joreyh6oQsvwpd2t7yY71aSOs='
WHERE
key_id = '65726f3b26fa3e36e525b25fecf54550d385f66cc2ea90b3c5ccdf7e66a5510b'
AND (
token = '0Frp5OgE7BUj7XQOM7Joreyh6oQsvwpd2t7yY71aSOs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)