UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Nj8LZb+cAyeo52TUtSinkvtYzpEWUgmRZ3I5R1qbCfg='
WHERE
key_id = '1e1bc09967e266f35195abc14d931b95c57c8f160b17e5783f7375d6e7e48760'
AND (
token = 'Nj8LZb+cAyeo52TUtSinkvtYzpEWUgmRZ3I5R1qbCfg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)