UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GcD7NX7aSGboMNTI3yxGa6RWEhYXM3C8KUEijQMm+EQ='
WHERE
key_id = '9d7a38f7dceb87e5b97d60141da6af256e6ecc1a10bd623636303bf436a62b74'
AND (
token = 'GcD7NX7aSGboMNTI3yxGa6RWEhYXM3C8KUEijQMm+EQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)