UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0aUOVmb2Xl5Ry6OkHENe5uAE28DjLBTLa+ysTarDy2U='
WHERE
key_id = 'a077698cc5eee71d30a22d647963fe7f901b7077b54d4c66692cf8fa17ae6c12'
AND (
token = '0aUOVmb2Xl5Ry6OkHENe5uAE28DjLBTLa+ysTarDy2U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)