UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c/jR+pVfdOOTOvJzl09XLM37vsasc7HkWD9/YZB9Q64='
WHERE
key_id = '9c299e4e192c8227c1c40895205c6102c96ad327448cfdda56a97c05db0a5355'
AND (
token = 'c/jR+pVfdOOTOvJzl09XLM37vsasc7HkWD9/YZB9Q64='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)