UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VunzgbdsR6MmyUvQFLbX9K+8GfvlP+B15m0oC3hgV0w='
WHERE
key_id = '50f18109e34ab3a40ba1e7259a95266c5a5b431e823682774afb6db4475fc398'
AND (
token = 'VunzgbdsR6MmyUvQFLbX9K+8GfvlP+B15m0oC3hgV0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)