UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YT+hibV8Zy7DociSJFpcQkY5ZWbQJwIMW5MxQjg3Gqk='
WHERE
key_id = '378aa6862892504debb1b179eaa64e0f0fa4a8d8d678de6e8518c19eab5640bf'
AND (
token = 'YT+hibV8Zy7DociSJFpcQkY5ZWbQJwIMW5MxQjg3Gqk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)