UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yTxCjDUS0X73VhjbUFSdLHFZy5A3oUCH7Gkforggcmo='
WHERE
key_id = '7b2ab823b4e2d857a9f48265153badd702dd69455328a1405525a3eb93a8336b'
AND (
token = 'yTxCjDUS0X73VhjbUFSdLHFZy5A3oUCH7Gkforggcmo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)