UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Up6kFGPgoJcgTiR0cpqUhYBdkhwOh+d2J9dnbMqXtl8='
WHERE
key_id = 'dc419f5da6f31b4f638e41a90940a9ca264586d306931a2a78e4565a93eed2ba'
AND (
token = 'Up6kFGPgoJcgTiR0cpqUhYBdkhwOh+d2J9dnbMqXtl8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)