UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ns6oIJ9YKCDiYbnwhUNUVyXCGVtqEOkU31bNHGC91YE='
WHERE
key_id = '382ab46c6ad96e9b9dadf9ff5179f74a9a3a526a77b42c4070198165cc1ac24b'
AND (
token = 'ns6oIJ9YKCDiYbnwhUNUVyXCGVtqEOkU31bNHGC91YE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)