UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Pi+3QWV9c6y23pgvPuTLC7aTzHFhb0hr2vLHt40XqWY='
WHERE
key_id = 'e47e46a0df1b3b307f94710d026b4d9f863c5ea3a7fea27b84ffb803a5ec6f2f'
AND (
token = 'Pi+3QWV9c6y23pgvPuTLC7aTzHFhb0hr2vLHt40XqWY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)