UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ziCV6CyGVs9VcoNAXigqYVX7b0pyBNQkPW4Vs3btkp0='
WHERE
key_id = '6727593eead5c1abf1f0e28672bce1dab716066360a4a6d5439604c902793f89'
AND (
token = 'ziCV6CyGVs9VcoNAXigqYVX7b0pyBNQkPW4Vs3btkp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)