UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z7Pve1Xv9F6uRJarIEGxka16yeSYNisG8UdOeRCpwf8='
WHERE
key_id = 'a301788923fd8275765a2a7ba5a3b980d2c18e9ccf798c9b0d69f2ea373b477f'
AND (
token = 'z7Pve1Xv9F6uRJarIEGxka16yeSYNisG8UdOeRCpwf8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)