UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ra7p4WmOti6YmEmg0C83pPIJaX0KdE4o3iyhOlyXObQ='
WHERE
key_id = '4e0e0ee328dc29710a7ff88edb0c899ce780a2598afe7405e6d9e540926e79bf'
AND (
token = 'ra7p4WmOti6YmEmg0C83pPIJaX0KdE4o3iyhOlyXObQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)